﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VoiceAI;
using VoiceAI.VoiceResponse;
using Windows.Data.Json;
using Xiaowei.Helpers;
using Xiaowei.Services;
using Xiaowei.Settings;

namespace Xiaowei.ResponseHandlers
{
    public static class DriverListResponseHandler
    {
        public static void Handle(IResponseData responseData)
        {
            if (responseData is IDriverListResponseData driverListResponseData)
            {
                string name = driverListResponseData.DriverName;
                if (/*SystemState.IsLocked*/false)
                {
                    driverListResponseData.ResponseText = "锁屏模式无法查看设备信息,可以进入桌面后查看。";
                    driverListResponseData.TTSUrl = XiaoweiAI.Instance.RequestTTS("锁屏模式无法查看设备信息,可以进入桌面后查看。");
                }
                else
                {
                    driverListResponseData.ResponseText = "小微正在为您查询中，请稍后……";
                    driverListResponseData.TTSUrl = XiaoweiAI.Instance.RequestTTS("小微正在为您查询中，请稍后……");
                }
                var model = new Models.DriverModel() {DriverName=name };
                model.FetchDriverList();
                driverListResponseData.DataContext = model;
            }
            DefaultResponseHandler.Handle(responseData);
        }
    }
}
